<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>取回密码</title>
<script language="javascript" src="<?=public_js_path();?>jquery.js">
</script>
<script language="javascript">
$(document).ready(function() {
	$("input").not("#submit_button").blur( function () {
		eval("chk_"+this.id+"()");
	});
	$("#submit_button").click( function () {
		var username_tag = $("#username_tag").html();
		var email_tag = $("#email_tag").html();
		if( username_tag=="" && email_tag=="" ){
			var username = $("#regist_username").val();
			var email = $("#regist_email").val();
			forgot_pwd(username,email);
			return false;
		}else{
			return false;
		}
	});
});
/**
* 验证
*/
function chk_regist_username()
{
    var username = $("#regist_username").val();
	username = $.trim(username);
	if(username==""){
		$("#username_tag").html("用户名不能为空！");
		return false;
	}else{
		$("#username_tag").html("");
		return true;
	}
}
function chk_regist_email()
{
	var email = $("#regist_email").val();
	email = $.trim(email);
	if(email==""){
		$("#email_tag").html("邮箱不能为空！");
		return false;
	}else{
		$("#email_tag").html("");
		return true;
	}
}	
function forgot_pwd(username,email){
	$("#pwd_info").html("<img src='<?=img_path();?>ajaxloading.gif' border=0 />已发送请求,请等待!");
	$.ajax({
		type: "POST",
		url: "<?=site_url(array('home','forgot_pwd'));?>",
		data: "username="+username+"&email="+email,
		success: function(str){
			str = jQuery.parseJSON(str);
			if( str.status==1 ){
				alert(str.info);
				$("#pwd_info").html('');
				return false;
			}else{
				alert(str.info);
				$("#pwd_info").html('');
				return false;
			}
		}
	});
}
</script>
</head>
<body>
    <div>
    	<form id="my_form" name="my_form" method="post" action="<?=site_url(array('home','forgot_pwd'));?>">
          <ul class="service">
              <li class="posclear">
                  <div class="registw1 posfloatl">用户名:</div><input type="text" name="regist_username" id="regist_username" />
                  *<span class="red" id="username_tag">请输入用户名</span>
              </li>
               <li><div class="registw1 posfloatl">邮箱:</div><input type="text" name="regist_email" id="regist_email" size="32" />*<span class="red" id="email_tag">请输入邮箱</span></li>
              <li><input id="submit_button" type="button" value="提交" />&nbsp;&nbsp;&nbsp;<span id="pwd_info" style="color:#FF0000"></span></li>
          </ul>
        </form>
    </div>                    
</body>
</html>